package cn.xawl.gulimall.product.web;

import cn.xawl.gulimall.product.service.SkuInfoService;
import cn.xawl.gulimall.product.vo.itemvo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author lh
 * @create 2020-10-29 17:48
 **/
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;

    @GetMapping("/{skuId}.html")
    public String item(@PathVariable Long skuId, Model model) {
        SkuItemVo skuItemInfo =  skuInfoService.buildItemInfo(skuId);
        model.addAttribute("itemInfo", skuItemInfo);
        return "item";
    }

}
